<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      var result = 0;
      for (var i = 1; i <= 100; i++) {
        if (i % 3 == 0) {
          result += i;
        }
      }
      console.log(result);	// 计算结果：1683
    </script>
  </body>
</html>